package priv.liu.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import priv.liu.example.domain.UserRepository;
import priv.liu.example.domain.entity.User;

@Controller
@RequestMapping("/user")
public class UserController {

	@Autowired
	private UserRepository repository;

	@RequestMapping("/add")
	@ResponseBody
	public User addUser(@RequestBody User user) {
		return this.repository.save(user);
	}
}
